﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>BsWrapper Ekle ve Guncelle</Title>
      <Shortcut>Ekle</Shortcut>
      <Description>
      Otomatik Ekle veya Güncelle Kodu Yazar.
      </Description>
      <Author>Fatih ÖZKAN</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>ParamA</ID>
          <ToolTip>
          </ToolTip>
          <Default>ObjeAdi
          </Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp"><![CDATA[
      
      public void EkleveyaGuncelle()
      {
        $ParamA$ p$ParamA$ = new $ParamA$();
        $ParamA$BsWrapper wrapper = new $ParamA$BsWrapper();
        if(BilgileriDoldur(p$ParamA$,wrapper))
        {
            wrapper.Ekle(p$ParamA$);   
        }
        else
        {
            wrapper.Guncelle(p$ParamA$);
        }
      }
      
      
      private bool BilgileriDoldur($ParamA$ p$ParamA$,$ParamA$BsWrapper wrapper)
      {
            bool yeniMi=false;
            
            if(Request.QueryString["Key"] != null)
            {
                int pk = Convert.ToInt32(Request.QueryString["Key"].ToString());
                p$ParamA$ = wrapper.SorgulaPKile(pk);
                if(p$ParamA$ != null)
                {
                    yeniMi = false;
                }
                else
                {
                    yeniMi = true;
                    
                }
                
            }
            return yeniMi;
      }
      
      
      ]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>